package Chapter11;

/**
 * @author 杨森
 * @date 2022年10月20日 17:03
 */
public class Homework02 {
    public static void main(String[] args) {
        System.out.println(Frock.getNextNum());
        System.out.println(Frock.getNextNum());
        Frock frock = new Frock();
        Frock frock1 = new Frock();
        Frock frock2 = new Frock();


        System.out.println("s=" + frock.getSerialNumber());
        System.out.println("s=" + frock1.getSerialNumber());
        System.out.println("s=" + frock2.getSerialNumber());

    }
}

class Frock {
    private static int currentNum = 100000;//衣服出厂的序列号起始值
    int serialNumber;

    public Frock() {
        serialNumber = getNextNum();
    }

    static int getNextNum() {
        return currentNum += 100;
    }

    public int getSerialNumber() {
        return serialNumber;
    }


}
